import React from 'react'
import Item from './OrderItem'
import { connectOrder } from '../../container/order/connectOrder'

class OrderAllList extends React.Component {
	constructor(props) {
		super(props)
		this.state = {
			fetched: false
		}
    }
    componentDidMount(){
        this.props.orderActions.showOrder(-1);
        this.setState({
        	fetched: true
        })
	}
	render() {
		const { orderData, orderDetail, detailisFetched, isFetched } = this.props.order
		const { showOrderDetail } = this.props.orderActions
		return (
            <div>
            	{
            		orderData.map(function(item,i){
            		return(
						<Item
							orderId={item.orderId}
							key={i}
							showOrderDetail={showOrderDetail}
							orderDetail={orderDetail}
							detailisFetched={detailisFetched}
							orderData={item}
						/>
            		)
            	})}
            </div>

		);
	}
}
export default connectOrder(OrderAllList)

